@layout("/common/_vContainer.html"){
<div id="app">
    <el-row :gutter="20">
        <el-col :span="6">
            <div class="card">
                <div class="p-tb-10">学生管理</div>
            </div>
        </el-col>
        <el-col :span="18">
            <div class="card">
                @if(shiro.hasPermission("/student/add")){
                <el-button type="success" v-on:click="location.reload()"><i class="el-icon-refresh"></i> 刷新</el-button>
                <el-button type="primary" v-on:click="modal.add = true"><i class="el-icon-circle-plus"></i> 添加</el-button>
                <el-button type="warning" v-on:click="modal.upload = true"><i class="el-icon-upload"></i> Excel上传</el-button>
                @}
            </div>
        </el-col>
    </el-row>
    <div class="card">
        <el-row>
            <el-form>
                <el-row :gutter="10">
                    <el-col :span=5>
                        <el-form-item>
                            <div>专业名</div>
                            <el-select placeholder="专业名" value=""></el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="年级">
                            <el-input placeholder="年级" value=""></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="5">
                        <el-form-item label="班别">
                            <el-input placeholder="班别"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <div>&nbsp;</div>
                        <el-button size="mini" type="primary">查询</el-button>
                    </el-col>
                </el-row>
            </el-form>
        </el-row>
        <el-table :data="page.data" highlight-current-row style="width: 100%">
            <el-table-column type="index" width="45"></el-table-column>
            <el-table-column property="no" label="学号"></el-table-column>
            <el-table-column property="name" label="姓名"></el-table-column>
            <el-table-column property="termName" label="年级"></el-table-column>
            <el-table-column property="majorName" label="专业"></el-table-column>
            <el-table-column property="clazzName" label="班级"></el-table-column>
            <el-table-column property="remark" label="备注" width="120"></el-table-column>
            <el-table-column>
                <template slot-scope="scope">
                    @if(shiro.hasPermission("/student/update")){
                    <el-button type="info" size="mini" v-on:click="toUpdate(scope.row)">编辑</el-button>
                    @}
                    @if(shiro.hasPermission("/student/delete")){
                    <el-button type="danger" size="mini" v-on:click="doDelete(scope.row.id)">删除</el-button>
                    @}
                </template>
            </el-table-column>
        </el-table>
    </div>

    <!--modal 4 add-->
    <el-dialog :visible.sync="modal.add" title="添加" width="50%" top="40vh" :modal-append-to-body="false">
        <div>
            <el-form :model="form.aModel" :rules="form.rules" label-width="110px" ref="addForm">
                <el-form-item label="学号" prop="no">
                    <el-input v-model="form.aModel.no" placeholder="唯一学号"></el-input>
                </el-form-item>
                <el-form-item label="名称" prop="name">
                    <el-input v-model="form.aModel.name" placeholder="名称"></el-input>
                </el-form-item>
                <el-form-item label="年级">
                    <el-select v-model="form.aModel.termId" placeholder="请选择年级">
                        <el-option v-for="item in sel.termList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="专业">
                    <el-select v-model="form.aModel.majorId" placeholder="请选择专业">
                        <el-option v-for="item in sel.majorList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="班级">
                    <el-select v-model="form.aModel.clazzId" placeholder="请选择班级">
                        <el-option v-for="item in sel.clazzList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="备注">
                    <el-input v-model="form.aModel.remark" placeholder="备注"></el-input>
                </el-form-item>
            </el-form>
        </div>
        <div slot="footer" class="text-right">
            <el-button v-on:click="modal.add = false">取 消</el-button>
            <el-button type="primary" v-on:click="doAdd">确定添加</el-button>
        </div>
    </el-dialog>

    <!--modal 4 edit-->
    <el-dialog :visible.sync="modal.update" title="编辑" width="50%" :modal-append-to-body="false">
        <div>
            <el-form :model="form.eModel" :rules="form.rules" label-width="110px"  ref="updateForm">
                <el-form-item label="学号" prop="no">
                    <el-input v-model="form.eModel.no" placeholder="学号"></el-input>
                </el-form-item>
                <el-form-item label="名称" prop="name">
                    <el-input v-model="form.eModel.name" placeholder="名称"></el-input>
                </el-form-item>
                <el-form-item label="年级">
                    <el-select v-model="form.eModel.termId" placeholder="请选择年级">
                        <el-option v-for="item in sel.termList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="专业">
                    <el-select v-model="form.eModel.majorId" placeholder="请选择专业">
                        <el-option v-for="item in sel.majorList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="班级">
                    <el-select v-model="form.eModel.clazzId" placeholder="请选择班级">
                        <el-option v-for="item in sel.clazzList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="备注">
                    <el-input v-model="form.eModel.remark" placeholder="备注"></el-input>
                </el-form-item>
            </el-form>
        </div>
        <div slot="footer" class="text-right">
            <el-button v-on:click="modal.update = false">取 消</el-button>
            <el-button type="primary" v-on:click="doUpdate">保存编辑</el-button>
        </div>
    </el-dialog>

    <!--上传学生excel-->
    <el-dialog :visible.sync="modal.upload" title="Excel - 上传学生" width="50%" :modal-append-to-body="false">
        <el-row>
            <div class="text-center">参考格式</div>
            <el-table border>
                <el-table-column label="学号"></el-table-column>
                <el-table-column label="姓名"></el-table-column>
                <el-table-column label="专业ID"></el-table-column>
                <el-table-column label="年级ID"></el-table-column>
                <el-table-column label="班级ID"></el-table-column>
            </el-table>
        </el-row>
        <el-row class="m-t-20">
            <el-upload
                    class="upload-demo"
                    ref="upload"
                    name="file"
                    action="/student/upload"
                    accept=".xls,.xlsx"
                    :multiple="false"
                    :on-preview="handlePreview"
                    :on-remove="handleRemove"
                    :file-list="fileList"
                    :auto-upload="false">
                <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
                <el-button style="margin-left: 10px;" size="small" type="success" v-on:click="submitUpload">上传到服务器</el-button>
                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
            </el-upload>
        </el-row>
        <div slot="footer" class="text-right">
            <el-button v-on:click="modal.upload = false">取 消</el-button>
        </div>
    </el-dialog>
</div>
<script src="${ctxPath}/static/modular/edu/student/student.js"></script>
@}
